package com.zzl.rabbitmq.utils;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

/**
 * Title: RabbitMqUtils.class<br>
 * Description: <br>
 * Copyright (c)  2021    <br>
 * Create DateTime: 2021/7/1 15:20 <br>
 *
 * @author zhuangzhuangliang
 */
public class RabbitMqUtils {

    //得到一个连接的 channel
    public static Channel getChannel() throws Exception {
    //创建一个连接工厂
        ConnectionFactory factory = new ConnectionFactory();
        factory.setHost("192.168.211.132");
        factory.setUsername("zzl");
        factory.setPassword("zzl");
        Connection connection = factory.newConnection();
        Channel channel = connection.createChannel();
        return channel;
    }
}
